import sys, time
from daemon import Daemon
 
class SyncDaemon(Daemon):
    def __init__(self):
        self.sleep=20
    def read_settings(self):
        #read synch settings 
        self.sleep=20
    def run(self):
        while True:
            self.update_local2sf()
            self.update_sf2local()
            time.sleep(self.sleep)
    def update_local2sf(self):
        #updates local changes to SF
        pass
    def update_sf2local(self):
        #Update SF changes to local database
        pass
    
if __name__ == "__main__":
        daemon = MyDaemon('/tmp/daemon-example.pid')
        if len(sys.argv) == 2:
                if 'start' == sys.argv[1]:
                        daemon.start()
                elif 'stop' == sys.argv[1]:
                        daemon.stop()
                elif 'restart' == sys.argv[1]:
                        daemon.restart()
                else:
                        print "Unknown command"
                        sys.exit(2)
                sys.exit(0)
        else:
                print "usage: %s start|stop|restart" % sys.argv[0]
                sys.exit(2)